<!-- S 改价 -->
<nz-modal
  nzClassName="custom-model-wrap"
  [nzFooter]="null"
  [(nzVisible)]="isMakeVisible"
  [nzTitle]="'改价'"
  [nzWidth]="750"
  (nzOnCancel)="handleCancel()">

  <div *nzModalContent>
    <div class="custom-model-body">
      <nz-spin [nzSpinning]="isLoadSpinning">
        <p class="change-price-title">机器信息</p>
        <div nz-row [nzGutter]="[0, 12]">
          <div
            *ngFor="let item of modelInfos"
            nz-col
            class="gutter-row"
            [nzSpan]="12">
            <div nz-row>
              <div nz-col [nzSpan]="8" class="item-label">
                {{ item.name }}
              </div>
              <div nz-col [nzSpan]="16" class="item-value">
                {{ item.value || '-' }}
                <span
                  *ngIf="['checkTime', 'shelvesTime'].includes(item.key) && item.value"
                  [ngStyle]="{'color': getTimesAgo(item.value) > 7 ? '#F56C6C' : '#909399'}"
                >
                  ({{ getTimesAgo(item.value) }}天前)
                </span>
              </div>
            </div>
          </div>
        </div>

        <nz-divider></nz-divider>

        <p class="change-price-title">改价</p>
        <div>
          <nz-form-item>
            <nz-form-label [nzSpan]="4">B端售价</nz-form-label>
            <nz-form-control [nzSpan]="20">
              <nz-input-number
                style="width: 180px;"
                [nzMin]="0"
                [nzMax]="999999999"
                [nzStep]="1"
                [nzPrecision]="0"
                nzPlaceHolder="请输入"
                [(ngModel)]="formParams.shopPriceB"
                (ngModelChange)="priceChange($event, 'b')"
              ></nz-input-number>

              <ng-container *ngIf="formParams.shopPriceB">
                <span class="red-color m-l-10">预估利润: {{ profitObjs.profitB }}</span>
                <span class="green-color m-l-10">成本利润率: {{ profitObjs.profitRateB }} %</span>
              </ng-container>
            </nz-form-control>
          </nz-form-item>

          <nz-form-item>
            <nz-form-label [nzSpan]="4">C端售价</nz-form-label>
            <nz-form-control [nzSpan]="20">
              <nz-input-number
                style="width: 180px;"
                [nzMin]="0"
                [nzMax]="999999999"
                [nzStep]="1"
                [nzPrecision]="0"
                nzPlaceHolder="请输入"
                [(ngModel)]="formParams.shopPriceC"
                (ngModelChange)="priceChange($event, 'c')"
              ></nz-input-number>

              <ng-container *ngIf="formParams.shopPriceC">
                <span class="red-color m-l-10">预估利润: {{ profitObjs.profitC }}</span>
                <span class="green-color m-l-10">成本利润率: {{ profitObjs.profitRateC }} %</span>
              </ng-container>
            </nz-form-control>
          </nz-form-item>

          <p style="padding: 0 0 0 117px;">
            <button
              nz-button
              nzType="primary"
              [nzLoading]="submitLoading"
              (click)="subPriceChange()"
            >确认改价</button>
          </p>
        </div>
      </nz-spin>

      <nz-divider></nz-divider>

      <p class="change-price-title">改价记录</p>

      <nz-table
        #priceTable
        nzSize="small"
        nzBordered
        [nzLoading]="isLoadSpinning"
        [nzShowPagination]="true"
        [nzHideOnSinglePage]="false"
        [nzData]="priceChangeTable">
        <thead>
          <tr>
            <th nzAlign="center">ID</th>
            <th nzAlign="center">操作时间</th>
            <th nzAlign="center">操作人</th>
            <th nzAlign="center">B端原价</th>
            <th nzAlign="center">B端新价</th>
            <th nzAlign="center">C端原价</th>
            <th nzAlign="center">C端新价</th>
          </tr>
        </thead>
        <tbody>
          <tr *ngFor="let data of priceTable.data">
            <td nzAlign="center">{{ data.id }}</td>
            <td nzAlign="center">{{ data.createTime || '-' }}</td>
            <td nzAlign="center">{{ data.follower || '-' }}</td>
            <td nzAlign="center">{{ data.oidShopPriceB }}</td>
            <td nzAlign="center">
              {{ data.shopPriceB }}
              <span
                *ngIf="getDiffValue(data.shopPriceB, data.oidShopPriceB) !== 0"
                [ngStyle]="{
                  'color': getDiffValue(data.shopPriceB, data.oidShopPriceB) > 0 ? '#67C23A' : '#F56C6C'
                }"
              >
                ({{ getDiffValue(data.shopPriceB, data.oidShopPriceB) }})
              </span>
            </td>
            <td nzAlign="center">{{ data.oidShopPriceC }}</td>
            <td nzAlign="center">
              {{ data.shopPriceC }}
              <span
                *ngIf="getDiffValue(data.shopPriceC, data.oidShopPriceC) !== 0"
                [ngStyle]="{
                  'color': getDiffValue(data.shopPriceC, data.oidShopPriceC) > 0 ? '#67C23A' : '#F56C6C'
                }"
              >
                ({{ getDiffValue(data.shopPriceC, data.oidShopPriceC) }})
              </span>
            </td>
          </tr>
        </tbody>
      </nz-table>
    </div>
  </div>
</nz-modal>
<!-- S 改价 -->